package com.example.shop_car_2208

import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.core.app.ActivityCompat
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.example.shop_car_2208.databinding.ActivityMainBinding
import com.example.shop_car_2208.entity.UserEntity
import com.example.shop_car_2208.mvvm.BaseViewActivity
@Route(path = "/app/MainActivity")
class MainActivity : BaseViewActivity<ActivityMainBinding>() {
//    @Autowired // 自动注入
//    @JvmField
//    var name = ""
//    @Autowired // 自动注入
//    @JvmField
//    var pwd = ""
    @Autowired
    lateinit var user: UserEntity
    override fun initData() {

    }

    override fun initView() {
        ARouter.getInstance().inject(this)//这行一定要存在，不然不会进行默认值操作
        //如果直接从欢迎页到界面，传值类型为序列化，会报销，传值为字符串，不会报错
       // Log.d("TAG", "initView: 接受到的用户名是${user.username}${user.password}")
        //找到fragment
        val navHost = supportFragmentManager.findFragmentById(R.id.fragmentContainerView) as NavHostFragment
        //找到让的控制器
        val navController = navHost.navController
        //进行绑定
        binding.botton.setupWithNavController(navController)


    }

    override fun getLayout(): Int {
        return R.layout.activity_main
    }

}